package com.example.besspringboot013.javabean.basicdatasource.config;

import com.bes.enterprise.gjc.spi.BasicDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BesDataSourceConfig {

    @Bean
    @ConfigurationProperties(prefix = "poin.datasource.master")
    public BasicDataSource dataSource() {
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://192.168.31.92:3306/test?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true");
        dataSource.setUsername("root");
        dataSource.setPassword("123456");
        dataSource.setInitialSize(50);
        dataSource.setMinIdle(50);
        dataSource.setMaxTotal(50);
        return dataSource;
    }
}
